<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title>凯胜项目管理系统</title>
	<link rel="stylesheet" href="static/css/bootstrap.min.css" type="text/css"/>
	<link rel="stylesheet" href="static/css/style.css" type="text/css" />
	<link rel="stylesheet" type="text/css" href="static/js/select2/select2.css" />
	<link rel="stylesheet" type="text/css" href="static/js/date/css/datepicker.css" />
	<style type="text/css">
		body{
			background-image:url("static/img/bg_main.jpg");
		}
	</style>
</head>
<body class="body">
	<%@ include file="include/top2.jsp" %>
	<br /><br /><br />
	<div class="container">
		<div class="row">
			<div class="span9">
			 <form action="task.jspx?m=edit&id=${goal.id }" class="form-horizontal">
			 	<fieldset>
			 		<legend>编辑任务</legend>
					<div class="control-group">
						<label for="input01" class="control-label">任务名称</label>
						<div class="controls">
							<input type="text" class="span5" name="goalname" value="${goal.goalName }" id="input01" placeholder="我的任务" x-webkit-speech="undefined" />
							<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
						</div>
					</div>
						<div class="control-group">
						<label for="input01" class="control-label">开始时间</label>&nbsp;&nbsp;:&nbsp;
						<div class="input-append date" id="dp" data-date="2012-02-21" data-date-format="yyyy-mm-dd">
 						 	<input class="span2" id="startDate" name="starttime"  size="16" type="text" value="${goal.starttime }">
  						 	<span class="add-on"><i class="icon-th"></i></span>
						</div>
					</div>
					
					<div class="alert alert-error" id="alert" style="display:hide;">
						<strong>Oh snap!</strong>
			  		</div>
			  		
					<div class="control-group">
						<label for="input01" class="control-label">截止时间</label>&nbsp;&nbsp;:&nbsp;
						<div class="input-append date" id="dp2" data-date="2012-02-25" data-date-format="yyyy-mm-dd">
 						 	<input class="span2" size="16" name="stoptime" type="text" id="endDate" value="${goal.stoptime }">
  						 	<span class="add-on"><i class="icon-th"></i></span>
						</div>
					</div>
					
					<div class="control-group">
						<label for="input01" class="control-label">任务描述</label>
						<div class="controls">
							<textarea class="span5" name="goalcontent"  placeholder="请对该任务做概要的描述" rows="8">${goal.goalContent }</textarea>
						</div>
					</div>
					<div class="control-group">
						<label for="input01" class="control-label">状态</label>
						<div class="controls">
							<select name="state" id="multiSelect">
								<option value="新任务">新任务</option>
								<option value="进行中">进行中</option>
								<option value="已完成">已完成</option>
							</select>
						</div>
					</div>
					<div class="control-group">
						<label for="input01" class="control-label">级别</label>
						<div class="controls">
							<select name="level" id="multiSelect">
								<option value="重要紧急">重要紧急</option>
								<option value="重要不紧急">重要不紧急</option>
								<option value="紧急不重要">紧急不重要</option>
								<option value="不重要不紧急">不重要不紧急</option>
							</select>
						</div>
					</div>
					<div class="control-group">
						<label for="input01" class="control-label">负责人</label>
						<div class="controls">
							<select name=""id="multiSelect">
								<c:forEach items="${userList}" var="e">
                					<option value="${e.id }">${e.username }</option>
                				</c:forEach>
							</select>
						</div>
					</div>
					<div class="control-group">
						<label for="input01" class="control-label">当前进度</label>
						<div class="controls">
							<input type="text" class="span5" id="input01" x-webkit-speech="undefined" />
						</div>
					</div>
					<div class="form-actions">
						<button class="btn btn-primary" type="submit">保存</button>
						<button class="btn" onclick="location.back()">返回</button>
					</div>
			 	</fieldset>
			 </form>
			</div>
			<div class="span3"> </div>
		</div>
	</div>
	
	<script type="text/javascript" src="static/js/jquery.js"></script>
	<script type="text/javascript" src="static/js/select2/select2.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$(".multiSelect").select2();
			
			$("#btnSave").click(function(){
				var v = $("#worker").select2("val");
				$("#workers").val(v);
				$("#myform").submit();
			});
		});
		
		
		
		$('#alert').hide();  
			var startDate = new Date(2012,2,12);
			var endDate = new Date(2012,2,25);
			$('#dp').datepicker()
				.on('changeDate', function(ev){
					if (ev.date.valueOf() > endDate.valueOf()){
						$('#alert').show().find('strong').text('The start date can not be greater then the end date');
					} else {
						$('#alert').hide();
						startDate = new Date(ev.date);
						$('#startDate').text($('#dp').data('date'));
					}
					$('#dp').datepicker('hide');
				});
			$('#dp2').datepicker()
				.on('changeDate', function(ev){
					if (ev.date.valueOf() < startDate.valueOf()){
						$('#alert').show().find('strong').text('The end date can not be less then the start date');
					} else {
						$('#alert').hide();
						endDate = new Date(ev.date);
						$('#endDate').text($('#dp2').data('date'));
					}
					$('#dp2').datepicker('hide');
				});
		
	</script>
	
</body>
</html>